#ifndef ELK_MAIN_WND_H
#define ELK_MAIN_WND_H

#include <QWidget>
#include "elk_web_view.h"
#include "elk_resource_view.h"
#include "elk_download_view.h"
#include "elk_preview_view.h"

namespace Ui {
class ElkMainWnd;
}

class ElkMainWnd : public QWidget
{
    Q_OBJECT

public:
    explicit ElkMainWnd(QWidget *parent = nullptr);
    ~ElkMainWnd();

private slots:
    void onWebTitleChanged(const QString &title);
    void onWebScreenModeChanged(bool fullscreen);

    void onContextMenuShowDetails(const QString &frame,
                                  const ElkContextMenuDetails &details);
    void onContextMenuDownloadMedia(const QString &frame,
                                    const ElkContextMenuDetails &details);
    void onContextMenuViewPageSource(const QString &frame,
                                     const ElkContextMenuDetails &details);
    void onContextMenuViewDisplayText(const QString &frame,
                                      const ElkContextMenuDetails &details);

private:
    void showWebView();
    void showDownloadView();
    void showResourceView();
    void showPreviewView();

    virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
    virtual void hideEvent(QHideEvent *event) Q_DECL_OVERRIDE;

private:
    Ui::ElkMainWnd *ui;
    QWeakPointer<ElkWebDelegate> webDelegate_;
    ElkWebView *webView_ = nullptr;
    ElkResourceView *resourceView_ = nullptr;
    ElkDownloadView *downloadView_ = nullptr;
    ElkPreviewView *previewView_ = nullptr;
};

#endif // ELK_MAIN_WND_H
